﻿using System;
using System.Data;

using SqlHelperForCry.Common;

namespace Torch.WL.Entity
{
    [Table("Tb_Auth", "", "Torch.WL.ConnectionString")]
    public class Tb_Auth : Info
    {
        #region SQL column name consts
        public const string SQLCOL_IMEI = "imei";
        public const string SQLCOL_SESSIONID = "sessionId";
        public const string SQLCOL_AUTHTIME = "authtime";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public Tb_Auth() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public Tb_Auth(string imei)
        {
            this.imei = imei;
        }
        #endregion

        public override void Init(DataRow row)
        {
            imei = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_IMEI]);
            sessionId = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SESSIONID]);
            authtime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_AUTHTIME]);
        }

        #region Properties
        #region Property <string> imei
        [Property("imei", 50, SqlDbType.VarChar, false, true)]
        public string imei
        {
            get { return _imei; }
            set { _imei = value; }
        }
        private string _imei = null;
        #endregion

        #region Property <string> sessionId
        [Property("sessionId", 50, SqlDbType.VarChar, false, false)]
        public string sessionId
        {
            get { return _sessionId; }
            set { _sessionId = value; }
        }
        private string _sessionId = null;
        #endregion

        #region Property <DateTime> authtime
        [Property("authtime", 16, SqlDbType.DateTime, false, false)]
        public DateTime authtime
        {
            get { return _authtime; }
            set { _authtime = value; }
        }
        private DateTime _authtime = DateTime.MinValue;
        #endregion
        #endregion




    }
}
